package io.bluerain.core;

import java.util.List;
import java.util.Map;

/**
 * Created by wscl on 2015/6/24.
 */
public class Obj {
    public static boolean notNullOrEmpty(Object obj) {
        if (obj == null)
            return false;
        if (obj instanceof String)
            return Str.notNullOrEmpty(obj.toString());
        if (obj instanceof List<?>) {
            if (((List<?>) obj).size() == 0)
                return false;
        }
        if (obj instanceof Map<?, ?>) {
            if (((Map<?, ?>) obj).size() == 0)
                return false;
        }
        if (obj instanceof Object[])
            return ((Object[]) obj).length == 0 ? false : true;
        return true;
    }


}
